<template>
  <div class="son1">
      <h3>{{num}}</h3>
  </div>
</template>

<script>
export default {
    data() {
        return {
            num:0
        }
    },
    mounted() {
        // 定义方法  并接收值
        this.$bus.$on('sendNum',(num)=>{
            this.num = num
            console.log(1);
        })
    },
    beforeDestroy(){
        this.$bus.$off(('sendNum'))
    }
}
</script>

<style lang="scss" scoped>
.son1 {
    width: 200px;
    height: 200px;
    border: 2px solid red;
}

</style>